<% admin_breadcrumb("#{Spree.t('actions.ship')} #{Spree::StockTransfer.model_name.human} \##{@stock_transfer.number}") %>


<% content_for :page_actions do %>
  <li>
    <%= button_link_to Spree.t(:back_to_stock_transfers_list), admin_stock_transfers_path %>
  </li>
  <li>
    <%= button_link_to Spree.t('actions.ship'),
      ship_admin_stock_transfer_path(@stock_transfer),
      method: 'put',
      data: { confirm: Spree.t('ship_stock_transfer.confirm') }
      %>
  </li>
<% end %>

<div id='stock_transfer_summary' class='fullwidth'>
  <%= render 'spree/admin/stock_transfers/location', stock_transfer: @stock_transfer %>
  <div class='shipment-description'>
    <div class='summary-field creator'><%= Spree::StockTransfer.human_attribute_name(:created_by) %>: <%= @stock_transfer.created_by.email %></div>
    <div class='summary-field description'><%= @stock_transfer.description %></div>
  </div>
</div>

<fieldset>
  <legend align='center'><%= Spree.t(:tracking_info) %></legend>
    <%= form_for [:admin, @stock_transfer] do |f| %>
    <div class='field-block alpha'>
      <div class='field'>
        <%= f.label :tracking_number %>
        <%= f.text_field :tracking_number, value: @stock_transfer.tracking_number, maxlength: 255, size: 0, class: 'fullwidth' %>
      </div>
    </div>

    <div class='clearfix'></div>

    <div class="actions filter-actions add_tracking_number">
      <%= f.submit Spree.t('actions.save') %>
    </div>
  <% end %>
</fieldset>

<fieldset id='stock-transfer-transfer-items'>
  <legend align="center"><%= plural_resource_name(Spree::TransferItem) %></legend>
  <%= render partial: 'transfer_item_table', locals: { transfer_items: @stock_transfer.transfer_items, show_expected: true, show_received: false, show_actions: false } %>
</fieldset>
